package com.fly.consumers;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RoundRobinRule;

import feign.Logger;


// springboot
@SpringBootApplication
// feign
@EnableFeignClients
// eureka
@EnableEurekaClient
@EnableDiscoveryClient
// 断路器
@EnableHystrix
// 断路器  + eureka + springboot 的集合
@SpringCloudApplication
public class MSkillFeignConsumersApplication {

	public static void main(String[] args) {
		SpringApplication.run(MSkillFeignConsumersApplication.class, args);
	}
	
	@Bean
	public IRule ribbonLoadBalance(){
		return new RoundRobinRule();
//		return new RandomRule();
//		return new AvailabilityFilteringRule();
	}
	
	@Bean
	public Logger.Level feignLog() {
		return Logger.Level.FULL;
	}
	 
	
}
